Fix bug in run_tests