Switch num/field to extern C; small fixes