Added unit test for #342