improving (hopefully without regressions) the cration of the database; fix bug in da