Fix getheaders termination condition on server