fix #1, fix #3, fix #4, fix #5, fix #6, fix #8
Merge pull request #9 from turn/updates

fix #1, fix #3, fix #4, fix #5, fix #6, fix #8