Optimizing checking for foreign nodes