timing algorithm fix