Fixed the carousel

added an IF in order to check whether the element exists