Fix bug with losing focus