fix goal expansion problems
fix handling of attributed vars.
typo in expansion.
fix broken semantics.
fix change in undef.
remove unneeded  call