Fix syncdb for clean database
Merge fixes for database setup