Fixed infinte loop