fixing bugs with how total cost is being calculated