fixes #22 and fixes #13