Change the For loop as the current implementation is iterating through
objects which are not elements, this is causing an error on smartcloud.