Added pickle. Fixed error when updating matrix