Fixed some (harlmess?) js errors in templates