Partial python3 compatibility