fixed the cleanup process