Check upgrade status function and improvement of some code.