Improvements to avoid numerical issues in bridge detection and bridge exclusion