Try doing frames calculation with int where possible.