fix some vulnerability and coding style