Fix run_tests to return appropriate exit code