fix javascript snippet