Remove unused variables and fix typos

1. Fix some typos
2. Remove some unused variables