fixes #1 and fixes #5