Fixed several typos and a undeclared variable