Fixing header decoding such that it works properly under both Python 3.x and 2.x.