Fix semantics of untilOutput
and untilInput
#2896
Merged
untilOutput
and untilInput
#2896