Fixed a lot of findbugs issues with string encoding