Better fix for #2645