Fix race when loading packages