Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp"