Fixed bug when quantity = 0 (fixes #3)