Fix #20, fix #18, fix #16, fix #14, fix #10