Fixed reading of input