bugfix: file appending mode didn't correctly work when file open flag is the same as user given flag