Yep. Avoiding introducing contamination is the toughest, especially until the mycilia have grown sufficiently vigorously.
More elaborate operations involve "clean room"
For my spore and agar media cultures and grain substrate culturing, I used a translucent storage tote with a clamp on lid laid on on its side. And an air filter fan blowing away from the opening. I think I described the set up in my thread.
You need to be rigorous about washing hands, wearing clean clothes, and using sterile tools. I used rubbing alcohol and peroxide sprays. I found out the hard way that using peroxide to "sterilize" my own skin was a bad idea. Rubbing alcohol did not damage the skin.
How did you open the bag? Best way I found is to squeeze the contents away from a band where you intend to cut, create a double-fold airlock seal on the side you want to preserve, then wipe down both sides of the band with alcohol, slice open with a very sharp knife dipped in flame or alcohol and spray down the opening to kill any airborne organisms. Deposit the excised portion of the bag in a prepared sterile container with a lid, and immediately re-seal the bulk of the bag with sterile tape or another method.
If you have a guillotine heat sealer, you can make a double seal and cut in between, but I never got around to getting fancy equipment. So my methods were pretty low tech.