added only if statement to temp directory creation