Fixed issues in various code snippets.