fixed the slide function