Correct string type check on Python 2