Why doesn't this method set the value?