Fix crash when running syncdb --migrate