Fix bugs in localStorage adapter.