Weak ref change for #668 and #729