Fixed bugs with frame and focus