clean up the state dir since it can affect tests
fix tests to work after cleaned state dir