add a few tweaks to prefix length calculation