Fixed the use of a dangling reference