Contains fixes for segment generation