Fixed FPS calculation code

Improves #9

Fixed FPS calculateion code so that the delay is calculated correctly
when running in limited FPS.