Fixed problems with spurious input

Not tested yet.