trying to fix double free