Fixed cleanup bug