Fixed some dangling pointers.