fixed variables leaked into global scope

Found by temporarily adding "use strict";