Fix mutexify for connect, cleanup.