Fixed an error in the isQuad function that was making it check the wrong index of the cross-term matrix.