Fix security issue writing log file