Fixed issues with templates