Added missing scaleMem code