Motors make IR sensors go nuts

I currently use three IR sensors bought from eBay on my robot. The sensors are the same with this product: http://www.dfrobot.com/wiki/index.php?title=Adjustable_Infrared_Sensor_Switch_(SKU:SEN0019). They are digital IR sensors that output a TTL signal depending on whether they are blocked or not.

When I first bought the parts, I used to have problems, mostly noise that made the sensors switch "on" and "off" when the motors were running. This is an obvious problem and I solved it using 3 capacitors on each motor (4 total). Now I'm facing another problem. When the motors stall or are stressed (for example when I load them a bit more or stop it) the sensors switch to "on", reporting that an object is present. This is wrong and makes the robot go nuts (on the other hand it has some serious dance moves!).

The question is, should I apply more filtering (and where) or is this a battery issue? The motor controller is the classic L298, I will try and separate the motor power from the board/sensor power and report back. I really do not want a different supply, so what can I try? By the way, the sensor's LEDs (that show if they detect an object) seem to flicker when the motors are stalled. Should I try and change the PWM prescaler of the motors?

EDIT: I didn't post this to the sensor subforum because I think it more of a motor problem.

I tried powering the Arduino using a 9V battery and the motors using my robot's batteries and the problem was eliminated. The question remains though, how can I filter the remaining noise and use the same batteries?

when your motors stall, the current consumption jumps up,

the voltage from the battery supplying them will drop,

Earth is not constant is the problem.

the answer is star wiring of the earth,

Select a good point, a single point as your earth reference.
wire the motors individually back to the earth point,
wire the arduino back to the earth point,
wire the power back to the earth point,

and then make certain the battery volts dont plumit when you stall the motors.