unit test for #225 and minor fix