Fix undefined ledger_current_index