Fixed an issue with the calculation of total number of frames.