fixed errors with templates