add upgrade logic to startup