update matrix stuff