Fix bug in new quantity support. Fixes #1437. Props @bseddon