Added an extra check in focus_view()