added fix for range our of bounds error in carousel logic