Correct detection of an illegal reference to a top event from a
sub-tree. Fixes #31.