fix end of input logic
1.3.1