added error checking on bencoding