fix bug with nextFrameID