Fix multiple res.WriteHeader invocations