fix javascript error in template