Unit tests from pull #136 and #137