fix print_write bug