closed issue #29, with corrections