Fixed dangling references