Fix bug causing infinite errors in REPL