Fixed max-idx for slider

When creating slider max-idx should be count-1 not count