Fixed monkeypatching in tests.