Change the order of things so the check local is done without taking the...

... lock