fix a typo error and add a missed snippet of code