Added checks to make sure that value are set only when they are different