Fixed temporary directory removal bug