prevent a possible double-free