Added patching to the local_to_global_top_down function.