Fix pkg upgrade leaving directories behind

Fixes:	#1085