fixed implementation of MemoryAdapter, added tests