Input routine fix (untested)