add validation for undefined objects