Unit test for BUG 402 / #37

See issue #37 for more details.