fixes #7
fixes #4, #5, #8