minor bug fixes on template