fixes #38, #22