add python support and fix a little bug.