Fix for python3 compatibility