also check for last item when clicking on carousel control + avoid js error when no ref