Added safe loop for objects