bugfix: edge detection algorithm