remove the double frees