Better fix for #1036