Improved handling if the machine looses the connection to the database