fix incorrect upgrade handling