fix #50, fix#49, fix #51, close #64