Fix connection to database issue