Fixed error message displaying logic.