fixed handling of the quadratic matrix