Minor fixes, no functionality change.
Fix off-by-one in REPL `send` mode; fix infinite loop in REPL error reporting.