Fix assignment of topids to pages