Merge pull request #1667 from edwinb/partial-eval

More partial evaluation improvements