modules.require should restore state after error (#9)