Changed the order of displaying error message.