Fixed pipieline cleanup (memory leaks)