fixed the clean up bugs