Fixed a memory leak causing weird distances, caused by a pointer being passed into lists and other methods.