final solution to expand-too-long problems