Fix recursion with templates and flag recurse = false.