DATAGRAPH-298: Made check for invalid instantiation more efficient