corrected generation of handle, added random choice of server