issue #73
plus some minor fixes