Fix for edge profiling, patch by 'Marc' for PR1857