adds validation for undefined variables