updated displayError and made sure empty value is not printed