fixed inversion in the slide function