Potential fix for #2704 and #2711