make collapse_vars
consistent with toplevel
#1608
Merged
collapse_vars
consistent with toplevel
#1608