Safety check to see if USER_AGENT is set before using it, since I was seeing errors in logs