Fixing bugs for GLM