Fixed unit test script to react correctly on errors.