fix calc_ipbits