fixes to program equivalence check, uncovered design bug
merge with rebecca