Made self-insert check consider lambda functions.