fixed races conditions found in server_test.go

fine tune fixes for the race condition in server_test.go file