improve test coverage and improve REPL