bugfix: end segments with different directions had the same hash