fixed bug with db issues