fix bug in writemime