Fixed bug: conflict of variable name (`$window`)