fixed some database connection errors