Fix for spurious exceptions during unit tests.