bug fix for getFrameClosest