added failure guard