backport BEM-930 into 0.6.x