Implemented revert function if a request fails