Snippet generation bugfixes