fixed bug about db access