Fix writing page ID