another bug fix around closure optimization