more careful checking for metamodel refs to local
classes/values/functions for #762