Fixes to js and templates