trying to fix bugs in slider code