Backport of a fix for page expansion