fixes to leveldb backend, tests