Added an environment variable to keep the index of each slave within the scope of a matrix job execution
Fixed some NPEs and the way the matrix_id variable is set. MatrixId starts from 1 instead of 0 now