Fixes merge forward error only present on master

This was a merge forward error. Almost all of the right code is present except for one line. This code was originally introduced with 3047343b61b118a9d7752211b5566fef8b5fe6b2.