add tests for reset command and fix some bugs.