Fixed string checking in Python 3.