Fixed WindowEnd bug