Fix null reference bug in make_segment().