what about count == 0? It doesn't make sense to have a segment with length 0 I think