fix bug by only setting values when different