fix a bug in the clean procedure