Improve precision of tests and fix exit code bug.