Add an extra switch_to_frame() to improve reliability