Proposed fix for #840