fix some C errors