Fix #10, #12, #14, #15, #16 and update api