fix core from double free