Fixed a bug when creating a new database