ensure correct ip address is used

this can turn out to be `None` while below (in the case of `REMOTE_ADDR`) it'll be `''`. Intentional?