Add validation for setting fields