Fix bug introduced when porting to c.