added an undefined guard