fixes #1, fixes #3 and fixes #5