Updated error messages to work properly