Fixed memory leak with conditions.