Discovered bug in new page writing, fixed in messy way, todo cleanup