Working out db issues