fixes #34 #38 #41 #39