Fix bug when creating db.