Fixed memory leak and missing dependency