fix bug in ExtractFunction introduced by recent work