franko,

what is your configuration for you PORTA inputs? did you used a pull down resistor to ground? You have an alternative to use internal weak pull-up features (OPTION_REG=7). PIC have sensitive inputs if you used pull downs. I had some problems that I also count the noise spikes if i used external pull downs, and most likely in activating motors. the motors are inductors that could spread some unwanted signals seen by the microcontroller. proper hardware design could prevent this kind of problems.

also, use
Code:
  ...(code here in betweens)
for ease. thanks

regards,