Fix #40: Spurious undo in live interactive mode

Problem identified and patch provided by @wilywampa