Bug fix for #2366