add handler for failure