quantity validation and scope binding +bug fixes