Port the outdated pipeline patch against master

This is a modification of 220df26ca8908fc1e727423d6f4712ed37c9126b that works against master.