update for python3 compatibility