Correcting EOFException issue