Fixed output filename generation when the version was set on a group

Reported by Simon E. Silva Lauinger.