Fix next frame bug