Practice clipping in and out tons with one foot on the ground. Also, practice while riding slowly down the street. Practicing unclipping at every position in the pedal rotation. And find a grassy patch of land; ride at a medium speed and then quickly bring yourself to a dead stop; let yourself fall to one direction. Practice unclipping the foot the corresponds to what ever direction your fall. This will help you learn to unclip in panic situations--like you when you stall out on a root during a steep climb.
Ride easier trails for a couple of weeks after you've done a couple of days practicing off the trails.