fixes #4, fixes #5, fixes #7, fixes #8, fixes #9, fixes #11