Validates value before setting them