fix bugs,see commit comment for detail