Added safety check for wrapping. (A TOP will be checked if wrapped
before wrapped by a new wrapper, which is important if TOP references
have loops.)