fix double free