Port fix for #869