[DB] Fix bugs.