Improve detection for non-cidr masks to prevent unwanted matches