migrations and fix sort