new middleware; negative quantity checking