Fixed gMat2d allocation bug