Fix for #34 #33 #32 #31