Fixed memory leak and added missing option