better error handling in repl