HW5: Fix some typo and bugs