Adding basic checks for dead connections to lookup query, inside lookup/recorder loops - bug 780