WyIL: bug fix for #356.  Also some refactoring for #355.