Fix for apparent bug where too many pipes are added to generated templates

Change-Id: I820714bf4e6baefc39768f9c50b1b326b271f2fa