Fixed memory leak associated with last commit