Bug fixes to functions_migration