Indecisive Transmission

I have a 1994 Jeep Grand Cherokee Limited 4X4. It has full time four wheel drive. Sometimes the transmission won’t shift gears until you get high in the RPM range. The transmission also drops in and out of overdrive on its own. When this happens, you can push the overdrivee button and it has no effect.