add check to prevent reponse being sent twice when a timeout occurs.