Fixed function for calculating FPS