bugfix: end segments with different directions had the same hash
Merge commit 'b99dad901abe447d29b4cccc6771ad09c77325f0'

* commit 'b99dad901abe447d29b4cccc6771ad09c77325f0':
  bugfix: end segments with different directions had the same hash