fixed floating point exception when trying to keep too many frames