fix #10 and minor fixes
fix #10 and minor fixes