fixed updating value in-place, ref update was failing for some cases