Fixed special cases when netmask is 0 or 32