fix cases when reference target is not defined.