fix some bugs, but still not ok