optimize & fix a typo