First pass at fix for #2039