update adaptive-wrap code