update code for cachematrix.R