move truncate to common code