Fixed a bug causing the call to w.WriteHeader() to infinite loop