Fix bug in upgrade command.