replace new decode calls with old ones

Replace new decode calls with old ones to support older python versions.