fix #360 + test case