Errors in Linear Patterned Features, using Equations, for Top Down Design

Hi all,

I am trying to create a tray for the top compartment of a tool box which is intelligently designed and adjustable for varying configurations.

Above are two versions of the master sketch I have tried ^^ (I will attach both files)

As can be seen on the right hand side it is controlled by a linear pattern at 4 in this case, the distances are controlled by equations so that each section is equally spaced.

When I add an extrude to this master sketch and then try to change the linear pattern values it creates errors.

The above image is an example of what happens when the master sketch is changed for different pattern numbers, it is obviously not stable

I will attach the file so that it can be examined properly, I am sure that the solution is relatively simple and would much appreciate if someone who is experienced in this area could point it out to me!

Thanks all.

SolidworksParts And Features