adding changes from montolithic repo including the max number of tries fix to prevent indefinite config tries