Fixes for RE error: illegal byte sequence on OSX.