fix some bugs for version 1