fixed bug when keyboard window is not [[UIApplication sharedApplication].windows lastObject]