fixing overlap calculation bug

The condition on when to break because of impossibility of time overlap
was backwards.