fixed bug in db script