fixed termination issues of server