BUG : decode byte-strings in afm.py

Attempt to fix #3523