fix c function