improved bencode.c