added back some old code to account for bugfix in z3 v4.3.2

(version 4.3.1 didn't pop function delcarations, and we thought that
was intended -- though surprising. It turns out they had a bug, which
they now fixed)