Fixed an error in cleanup