Fixing memory problem in Magnitude square test