fix double-free