Fixed error handling during device uninstallation
Improved upgrade handling and error code handling during installation