fix several bug.