Well, I guess you have found the problem already: "the surveys that use custom templates".
I read this as if the surveys that use the standard templates do not have this problem?
So I would look into the custom templates and see if there is anything that causes this problem. By the way SURVEYLANGAGE should be rather SURVEYLANGUAGE, right?
Looking at the source code I can see that there are problems with the tags.Especially with
Code:
groupbygroup showprogress showqnumcode-X">
There is definitely something wrong in this template you are using.