CLJCLR-31: fix locking mode on Ref and make ensure properly lock Ref