fixed bugs

fixes #13
fixes #12
fixes #11
fixes #10
fixes #8
fixes #6
fixes #5
fixes #4
fixes #3
fixes #2