some improvements about setting amount = cost * capacity