corrected cleaning up of the whole system