fixed error messages for consistency and renamed variable