Fix checkstyle and memory leak