Fix package script race during upgrade