fix scale in 2D; add generic matrix upload function