improved curl thread-safety