Fixing return and error messages.