Update to fix #14, fix #15, fix #20