fix unlimited loop