Fixed cleanup of tmp directory