fixed a dangling pointer