Fixes for exporting to workspace and to .mat file.