modify saving .mat files