fixed jsvascript and template generation