fix grab focus code