Fixing Repl exception on undefined