Add remote data store test case, fix related bugs.