fixing some python3 compatibility issues