adjust tests to make sure exception is thrown as expected
Fixed race condition on reporting errors in the tests