refactor. fix #10, #15