Fixed the removePlateau function.