fixed bug in run_test and improved output