fix Matrix3D bugs