Port fix for #800