fix the timeline pos algorithm