Fix issue with corner detection