Fixed a bug with handling errors in the test script