fix a bug in the start/end generation where we could miss a few frames