Make code python3 compatible