Fix errors in cleanup