The trip to Egypt was very successful and when it was time to return to Eretz Israel, he joined a large group of people travelling on donkeys. In the desert, the travelling group took a break to eat and Rabbi Yaakov Abulafia fell into a deep asleep. When he woke up, he couldn't find his travelling group. Somehow, they continued the trip without him and he was left all alone in the desert.
He sat down to figure out what to do and about 2 hours later, he heard loud noises. He raised his eyes and saw strange-looking men plowing the ground with oxes, and wickedly beating the animals with no mercy. The oxes were pulling extremely heavy yoke and were making loud piercing noises as if crying to heaven for help.
Rabbi Yaakov Abulafia was pertrified and covered his ears trying to block out the ox's loud crying. All of a sudden, he sees the oxes turning into human beings and the human beings that were beating up the oxes turning into oxes and after a while, the same thing happened again; the human beings whom were oxes were beating up the oxes that were just human beings. This scene kept repeating itself till nightfall.
The miserable humans/oxes approached Rabbi Yaakov Abulafia and when he looked at them, they fell on their faces and begged that the Rav take them to the Arizal to save them from their torments.
It was from Shamayim that Rabbi Yaakov Abulafia fell asleep in the desert and left alone so he should witness with his eyes and ears and have mercy on these tomented people/oxes and bring them to the Arizal to help them complete their tikun.
Rabbi Yaakov Abulafia promised to help them and one of the men put the Rav on his shoulder and within a short time, they were in Tzfat. The Rav told the Arizal everything he just witnessed and the Arizal told him, "These miserable souls used to shave their beard with a razor. One that shaves his beard with a razor are reincarnated into an ox פאת ראשכם - Roshei Tevot פר ox. (As it says לא תקפו פאת ראשכם ולא תשחית את פאת זקנך "You shall not round off the corner of your head, and you shall not destroy the edge of your beard.")
The Arizal revealed to Rabbi Yaakov Abulafia that these souls are from the root soul of Rabbi Yaakov Abulafia and that's why his good deeds are rolled through him to help these souls. The Arizal showed him how to do tikunnim and kavanot for these souls and Rabbi Yaakov Abulafia did it completely.
After some time, the souls came to Rabbi Yaakov Abulafia in a dream and told him, "Rest your mind as you rested our souls. Baruch HaShem, we have reached a complete rest."