Added test for upstream server, minor improvements