another thread safety fix