Fix metatable issue in Database