fix to use O_WRONLY flag.
Merge branch 'develop'