Corrected some bugs in the RefCounted.