Fixes edges detection