Add EndPage at correct spots