Fixed some pmd and findbugs errors