Fix code example syntax error and correct spelling mistakes

While I was reading the docs I noticed these errors.