Fixed database errors