If an MXD is modified, the index number for a layer in a mapservice may change since it just a relative number derived from the order in which the layers were added to an MXD. When that happens, the developer needs to track down all relevant code that specifies that index number and correct the index number to new modified index number.
Is there a different method that does not use index numbers to specify the layer desired from a mapservice?