Fix compile warning and findbugs defects