Improve validations for quantity

Related to #41