fix some sharestate bugs