handling edge case where no segment is found