fix potential issue with variable frame rate