Fix for thread safety (Lemay)