Some small fixes in window.addEvent();