fixed tests and return 500 status code if test fails