backport 569648f2 into dharma 10.1 (because git master has changed too much, this has been done by hand)