fixes #1 #4 #7 #8