fixing typo and adapting javascript templates