fixed error messages to work with AJAX