fix bug; add total cost;