fixes #5 #3 #6