tests for #361
more rigorous tests for #361
fix #361