The connection to the database now works in a more robust way.