Fix compatibility for Python3 (See #1).