Added logic to only create config file and backup old one  only if db connection was successful