More fixes for encoding errors