Fixed incorrect pthread_key usage.