fix bugs in function  is_bracket_vaild