Arduino strange behavior with dc motors

I added one capacitor to the motor's supply (47uF) and three(!) capacitors (0.33uF) to the every motors(very very close to the motor) and then problem was resolved! Thanks!