Fixed the bugs, checkstyle and pmd problems.