fixes issue #297, add unit test