analogWrite causes missed/glitchy Interupts

So like I said the encoder works 100% as it should, until i use an analogWrite in voidMain, when I use the PWM pins 5,6 which are also in potrD along with the encoder things tend to get really messed up. Now that I have switched the PWM to pins 9 and 10 in portB every so many clicks the encoder counts up twice instead of once. I do not have this problem using any other commands in void main besides analogWrite

void setup()  {
  Serial.begin(9600);
  DDRD &= ~(1 << 3);
  DDRD &= ~(1 << 4);
  DDRB |=  (1 << 9);
  DDRB |=  (1 << 10);
  attachInterrupt(1, ISR_A, CHANGE);
}

void loop(){
  analogWrite(9, 200);
  analogWrite(10, 150);
}


void ISR_A(){
  delay(10);
  if (digitalRead(3) == digitalRead(4))
   {
    encoder0Pos++;
   } 
  else 
   {
    encoder0Pos--;
   }

Serial.println (encoder0Pos, DEC);
}

the only thing I can even think of is to set up the PWM using standard AVR registers and port manipulation instead of analog write. Ive been having a hard time figuring out the timers though.