bug fixes in template