fixed write and change_size