Add the new failure manager class
Fixed some bugs.