fix a memory leak
ensure that the C entity achieves the same result as others