Return matrix correctly, and save and restore to preferences.