Oberon witnesses Demetrius being cruel to Helena in the woods and devises a plan to solve her love problems using the magic flower. Oberon gives Puck the assignment of enchanting Demetrius, however, Puck muddles things up.
When Oberon sees that Puck has mistaken Lysander for Demetrius so that now Lysander is in love with Helena when he should be in love with Hermia, Oberon tells Puck to fly "swifter than the wind" and to use "some illusion" to bring Helena to there part of the forest where Demetrius is at (III.ii.95,99). Oberon plans to sprinkle Demetrius's eyes himself with the juice of the magic flower so that when Helena appears, Demetrius will see her and fall in love with her instead of Hermia.
Puck obediently brings Helena as she is being pursued by Lysander who is pleading for her affection. Lysander's pleas wake Demetrius who then falls in love with Helena, as planned. However, Puck finds great amusement in watching two men now pursue the same woman, as we see from his famous lines, "Shall we their fond pageant see? / Lord, what fools these mortals be!" (III.ii.115-116). We further see his amusement in his lines, "[T]hings do best please me / That befall preposterously" (121-122). In other words, Puck is saying that two men pursuing the same woman is absurd and absurdities please him best.
Since Puck mistook Lysander for Demetrius thereby making both men fall in love with Helena, Oberon's initial plan of fixing Helena's love problems failed, creating an even bigger mess. However, both Oberon and Puck fix the mess in the end. After Demetrius is successfully enchanted, Oberon gives Puck further instructions to solve Hermia's problems. Oberon sees that the two men are about to fight, so he tells Puck to cover the forest with thick, black fog and make both men pursue him all over the forest until they drop from exhaustion and fall asleep. While Lysander is sleeping, Puck is supposed to enchant Lysander's eyes with the juice from the flower so that when Lysander awakes and sees Hermia by his side, he will fall back in love with her. Puck is also instructed to make all of the Athenians believe that everything they had experienced that night was a dream.
Puck successfully caries through with Oberon's plan, righting all his wrongs and properly joining the two pairs of lovers as they should be. Not only that, Oberon and Titania bless all of the newly married lovers in Theseus's house, including Theseus and his bride Hippolyta, ensuring everlasting love for the couples and healthy children. Puck even apologizes to the audience, saying, "Give me your hands, if we be friends, / And Robin shall restore amends" (V.i.432-433).
Hence, we see that while Oberon's initial plan failed and became muddled, in the end both Oberon and Puck fixed everything.