Fix cleanup bug