fixed run_server function. Now it seems to work. Need to fix run_client