Fix minor bugs

The new type-enclosing stuff used in merlin-locate has a small flaw: if the locate fails, the type-enclosing machinery is still activated, stomping the error message. This PR fixes that, and some ancillary minor stuff.