Fixed upgrade bug [tracker 1950]