Fixes several leaks to the global scope.

I stumbled upon these, when trying to run the unittests.

Perhaps a port to coffeescript could prevent these. ;-)