BUG: Fix 'TypeError: expected bytes, str found' on Python 3