Fix for #840