fix some bugs, still not stable