Debian: fixed bugs in upgrade