Fix checkLocalNames

Also cleanup in using __METHOD__ instead of __FUNCTION__, use
wfGetDB directly instead of wfGetLB.

Change-Id: Ic40e8cd2511491445f530faadd6fdf5a2873a5e2
(cherry picked from commit 605d61f786f73ebea6f8429108159af96f19933f)