fix start/end calc