Fix a typo and an undefined variable case