This often happens with H16's. There are two things that you can do to aviod/minimise this problem. The first is once you've hoisted the mainsail and locked it in, run the halyard around the starboard shroud and trapeze wires so that the halyard runs down the side of the mast, the second is to fix the top two battens in your sail permanently (there should be a number of threads on the different methods of doing this in the forum) and then trim off the ends of the battens so they are flush and there's nothing to catch on the wires as you tack.
Hope that helps.