Try dist1 = vec_dist(temp_ent.x,nullvector); and dist1 = vec_dist(nullvector,pos); If the first approach crashes, set planets[x] manually to zero when you remove planet x. If that doesn't help too, try to isolate the problem with sys_marker.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual