Add test case for gh 861