fixed a bug in clean_snapshots