add failure handling