merge_var and global_merge_var functionality