fixed history and exit codes