potentiometer and servo, jitters at max value

Hey everyone so i am moving two servos with a potentiometer and everything is great no jitter except when i max out the potentiometer in one direction. So say i max out my potentiometer at 90 degrees which is fine for the servo, if i hold it there then it shakes. but if i hold it in the opposite direction and make it go to 0 degrees it doesn't shake. Any ideas on how to stop this? Heres my code. Very simple.

#include <Servo.h>
Servo servo1;
Servo servo2;
int Xin= A0; // X Input Pin
int Yin = A1; // Y Input Pin
int KEYin = 3; // Push Button

void setup ()
{
pinMode (KEYin, INPUT);
Serial.begin (9600);
servo1.attach(2);
servo2.attach(3);
}
void loop ()
{
int xVal, yVal, buttonVal;

xVal = analogRead (Xin);
xVal = map(xVal, 0, 1023, 0, 90); // scale it to use it with the servo
yVal = analogRead (Yin);
yVal = map(yVal, 0, 1023, 0, 90); // scale it to use it with the servo
buttonVal = digitalRead (KEYin);

Serial.print("X = ");
servo1.write(xVal);
Serial.println (xVal, DEC);

Serial.print ("Y = ");
servo2.write(yVal);
Serial.println (yVal, DEC);

delay (5);
}

What's the output of the serial line if the Servo "shakes", how much movement do you register?

Sounds like a bad pot, intermittent at the end of travel, run this mod and see what the ADC values look like.

#include <Servo.h>
Servo servo1;
Servo servo2;
int Xin= A0; // X Input Pin
int Yin = A1; // Y Input Pin
int KEYin = 3; // Push Button

void setup ()
{
  pinMode (KEYin, INPUT);
  Serial.begin (9600);
  servo1.attach(2);
  servo2.attach(3);
}
void loop ()
{
  int xVal, yVal, buttonVal;
 
  xVal = analogRead (Xin);
  xVal = map(xVal, 0, 1023, 0, 90);     // scale it to use it with the servo
  yVal = analogRead (Yin);
  yVal = map(yVal, 0, 1023, 0, 90);     // scale it to use it with the servo
  buttonVal = digitalRead (KEYin);
 
  Serial.print("X = ");
  servo1.write(xVal);     
  Serial.print(xVal, DEC);
  Serial.print("\t");
  Serial.println(analogRead(Xin));
 
  Serial.print ("Y = ");
  servo2.write(yVal); 
  Serial.println (yVal, DEC);
  Serial.print("\t");
  Serial.println(analogRead(Yin));

  delay (500);
}

The output i get from the serial monitor says just 0. Doesn't change much at all very stable. It shakes when it is at 0, but it i move the pot the other way to 90 it is completely fine, no shaking and it is a stable 90. If its on a flat surface and i move it to 0 then it shakes as much as moving itself across the surface.

outsider: When i run your code i get this for when i push th pot to 0.

483
0
X = 0
Y = 42

and i get this for when its at 90:

485
1023
X = 90
Y = 42