checks for parent id == -1 now instead of p_id == agent_id
removes tmp files even on failure
added guard to check for parent id in invariants
a cleaner message
final fix in... needed to access invariant of agent id if parent == -1.