[foundation] handle trailers better