Fixed a bug in calculating the timestamps.