improving cleanup of tmp files