better validation for instance variables