fixed potential dangling reference