Fix infinte loop