v4 patches for issues #870 and #871