Replaced cursor handling when loading blocks from the database with a scoped pointer so that deletion of the cursor is automatic.