serialEvent call

It gets called at the end of each iteration of loop(), if there is something in the serial buffer. Without seeing the rest of your sketch, its hard to tell what the problem is.