frame rate calculation fix from Andrew Mace