Fix typo and bugs