Improved test case for #587