added applyPreambleTrailer