More bug fixes.

  - A file should not be unregistered if its deletion failed.
  - Package removal should be allowed when the user initiates it.
  - manager_remove() should check whether the package is installed first - otherwise, nothing depends on it and cleanup is performed.