Fix GLM calculation