fixed nested database creation bug