fixed writen and append