Changed file mode for logs from a+ to w+