fixes #17 #19 #20 #21 #22