Stop leaking 'module' global

The code was leaking a 'module' global variable, which was breaking my unit tests. This is a simple fix that should prevent a few headaches.