fix #11 fix #8 fix #10 fix #1 fix #12