avoid double freeing