Minor fixes to __repr__ so it works on python 3