Wip cleanup memory store

Should return `n`, not 0.