fix segment printing bug