python3 compatibility fix