bugfix for caching the qmatrix