BUG:fix several bugs