test for #1182 and a fix