Fix encoding errors stemming from not using repr()