reset state after end of input (#3)