Fix for #20 #22
Fix for #23