fix error messages to show the right mesage