monkeypatching quit and exit fix