Bug fix: added missing validation and corrected the error messages to be
more explicit