prepare Gaia for bug790231

My previous PR was based on the latest Gaia repo and was difficult to merge with your branch… I hope this one will make sense.

This is an attempt to prevent your WPS patch from breaking Gaia until bug 790231 lands. If it works, please merge it so your Gaia PR can be updated.