Added a testcase for #363. This bug was fixed along the way.