Fix dict encoding and incorrect test. Bencoded dicts must encode the keys in sorted order.