fix late pthread_mutex initialization