re-add Marc's patch that got lost in the merge