I dont think hat thre is a problem with the script from ispconfig as it works on several thousands of servers that updated already to this version. I guess there must be still some modifications in your installation like a customized plugin or a similar problem that cause this.
That it eorks after sou removed the vhosts loop indicates that sour server uses a ispconfig apache plugin from a older release and not the current release. Ensure that you dont use a customized apache plugin without adopting it to the new ispconfig release. If you are sure hat you dont use any customized code, then check that the apache plugin in the plugins-availabe directory of ispconfig is really the one from the latest tar.gz and that the symlink in the plugins-enabled directory really ponts to this new plugin file.