Fixed bugs in amortization logic