fix javascript in snippets