Fixed string-related issues in Python 3