fix db upgrade

This should fix the "old_sync" upgrade problem.