Error messages fix.

Error messages are not displayed to the user correctly.