Load done event now created by the server.

diff --git a/server/thread.c b/server/thread.c
index 72c1fce..3963f60 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -158,14 +158,12 @@
 
     if ((thread->next = first_thread) != NULL) thread->next->prev = thread;
     first_thread = thread;
-    add_process_thread( process, thread );
 
     set_select_events( &thread->obj, POLLIN );  /* start listening to events */
     if (!alloc_client_buffer( thread )) goto error;
     return thread;
 
  error:
-    remove_process_thread( process, thread );
     release_object( thread );
     return NULL;
 }
@@ -611,6 +609,7 @@
             {
                 set_reply_fd( current, sock[1] );
                 /* thread object will be released when the thread gets killed */
+                add_process_thread( current->process, thread );
                 return;
             }
             release_object( thread );