fix tests; fix race condition in accept goroutine termination