Correct the handling of page references & flagging (mostly in error conditions.