Various fixes for leveldb, but still not compiling