Fixed issue where server could try to send headers more than once