modified bag.py: temp dir is deleted if it exists