Multiple bugfixes in sync_sockets and performance tests