Fixed permission to write to the log file
Added missing file mode