Fix QMat linking issues.