Check before setting value