Fix memory leak caused by circular reference
fire ERR_NOTREGISTERED when appropriate