fixes #1 fixes #2 fixes #3 fixes #5 fixes #6