Move variable declaration to top of function
Fixed HTTP exceptions on keep-alive connections