Fix some critical bugs + support msgpack and BSON.