Fix small overflow bug in ExpandableMemory