[Bug 165799] patch does not preserve context - resets to tmp_t