bug fix - zero-length segments