#139 fixes. Additional unit tests