Fix issue #44
Issues #46 and #48