Fix database creation code