Correct end of input bug