fix for mat save