fixed bug in quantity sold calculation