Add simple test cases
Improve replica recovery