correct file mode when opening log