Update for code snippet extension and fix some other bugs.