fixed an crash due to window delegate
fixed an crash due to window delegate