rewrite labels, move ingestlog writes into correct order