Fixed how merge_vars and to elements are applied.