Made the tests work with Python 3
Fixed segfault on invalid unicode char on python 3