change to MemoryStorage to avoid segmentation error