Fix reference counting order of operations for Ref assignment operator