checkstyle and bug fixes