Fix recursive loop