If you are sending lines from a Windows machine they may end in CRLF ("/r/n"). Serial.parseInt() may see that as two line endings. The second line ending would be for an empty line so the numerical value would always be zero.
I don't see any easy way to fix the problem. If you always throw away a character after parseInt() it will fail a different way with a non-Windows host.