Fixed bugs in Quantity