fixed a bug that no upstream is set after start
add a function for upgrade