update the method we upgrade, and add new debug function