bug 893: fixed query for check_certificates