You aren't using PORTD in your program, so they are floating.
Leakage currents could make them vary when other pins transition.

Try adding...
Code:
PORTD = 0
TRISD = 0