Python 3 compatibility fix

bytes.decode called before the re.sub, not after