fix a potential dangling pointer