fixing a bug with focus lost