fix some bug about quantity.