prevent double lock case with fallback lookup. code cleanup only

The spec allows for a double lock, it's just pointless.  There are 2 cases where this is
called so make it consistent and only lock the source tree outside of the fallback lookup.
small parsing fix for query parameters