fixes #28 and fixes #31