Fix a memory corruption in leveldb.
Fix a compile error on OS X.
Use static_cast in NewRunnable calls to fix compile error on OS X.