Fixing Python 3 compatibility