fixed typo and unused variables