I've had that problem when I first got my M4. Make sure the wires are ran on either channel of the handgrip properly so there is no added resistance in the wires. From struggling with that the connectors on my motor initially broke working perfectly with the motor out but breaking the circuit when the cap is placed for the handguard. That was the first problem!
The piston seemed to be going in a half cycle every time with a 8.4V Nickel Metal Hydride and a 9.6V, both at full charge. After taking the mechbox apart several times i discovered a wearing of the wires at the opening to the motor in the bottom part of the mechbox! That was causing a ground looping problem which was overheating my battery. Caught that problem and re-wired the bugger. This was caused by the play in the motor where the wires weren't allowing it to freely move in the handguard! That was the second problem. Still no go with the 9.6!
Third times the charm
Two lovely weeks of misery later, my buddy had his 11.1 Lithium-Polymer 900milliAmpereHour batteries arrive. My gun being an A.P.S. ASR101 (M4A1) was recommended by E-Hobby Asia to use an 11.1 Li-Po, and of course hearing horror stories about Li-Po's ripping the guts out of gearboxes was hesitant at first, but at this point if I needed to order parts, I at least knew how to put the bloody thing back together.
VOILA an 11.1 Li-Po had enough juice to get her moving ... and then some! But having the same problem with my p90 led me to believe that the problem was a poor shim job, or at least in the case of the APS, ... NO SHIM JOB!... There wasn't a single washer in the mechbox stock from the factory.
The moral of the story is order some shims and visit mechbox.com and rip that bastard apart. There are a few shimming vids on youtube that are helpful also.
Hopefully this helps. Cheers!