Fix use of window instead of $window