Fixing some bugs in template inclusion.