improve display title output logic