fix improper quoting
optimized temp file cleanup