[BUGFIX] Defensive check in _addMetamorphCheck to prevent exception  #5233