fix local function definitions (letrec is final)