fix truncate loop