database scoping issue?