Fix for #27
Fix for #24
Fix for #21