improve fix for #961