Fix race condition in localization of external resources