add a namespace to create the legalprofile db
fix a bug caused by lazy evaluation + db access