Fix javascript in preview.html