fixed errors in cleanup