detection at the borders was a bit unstable. bool was not correct (in the case of 0) and we should keep the last value. Let's be consistent with Python. The first value is included, the last is not
Merge branch 'detsp0' into detsp