better handling malformed ledgers