Fixed a bug where XE was interfering with edge-following optimisation