refactor code
fix a typo caused warning