Restore Feature #587

This should restore feature #587. As far as I can see this was the only part of the original commit which was lost.