fixed bugs in templates and add google analytics