fix some bracket bugs and indentation