Correct problems connecting to database