Added a malloc for maxWorkItem array and fixed maxWorkItem per dimension