maintainer scripts improved to restore state after deinstalling the package