Fixing database.template issue