Accessing res.code without checking res first, do:

```ruby
			if res and res.code == 500 and res.body =~ /<faultstring>(.*)<\/faultstring>/i  
			        faultcode = $1.strip
				fault = true
			elsif res and res.code != 200
				vprint_error("#{rhost}:#{rport} - Error in response")
			end

```