fixes #45 and fixes #47