calc_varprim_ns seg fault to be found