Added proxy support and corrected sed var passing