Remove infinite loop in slider