fixes #5 #8 #2 #3