Fix focus function