Fix TypeError when no User Agent is provided.