access nonce_count in a thread-safe way

The instance var @nonce_count is read and updated only once when
starting to generate the auth header value. Further accesses to the
nonce_count value are done using the local variable.

fixes #2