Fixed bug that the algorithm of "get_amount" is wrong