improved getFrameAt method.