Add more robust checks for iterable objects.