implmenting blockchain_db::fetch and various bug fixes