Fixed and improved mac GLM running subfunction