Fix python 3 compatibility for v0.4

also replace insidious tabs with spaces