fixes #38 and fixes #39