[BUGFIX] Fix bugs for database scheme