fixed kernel cleanup function, added function to purge removed packages