Fix for User Agent not always being available (for example via command line)