fix stats for failed connections
add max_parallel_handshakes parameter