added check on completness of the template