Fix database creation bug