Fixed undefined variable and a small typo