fixed error when deleting pages