Fixed critical bugs on memorystore code