fix broken sample, and add support for chained context