Fix dirty merge

Reinstates a fix from bb345a8dbe05b582fada01907296fd0ac112ddd4.