add before the writing