It sounds like you may not be using enough powder in the pan. If the powder in your pan is loose and not under compression by the pan cover on the frizzen, it can shake around in the pan and may be why it is leaking out the pan seam you said was not perfect on your rifle. Try this. Put enough 4F powder in the pan so that it is just a leeeetle tiny bit "mounded up" in the pan so that the pan cover definitely presses against the powder when you close the frizzen's pan cover. The thing here is to make sure the powder is not loose in the pan but is under compression from the spring on the frizzen pan cover. That should hold it in place.
If your frizzen spring is of the proper temper and strength, it should hold the pan cover tightly against the powder....which should cause the powder to press not only against the pan cover....but also press against itself into a slightly compressed cake under spring tension from the pan cover. Even if the powder around the very edges of the pan might escape and fall out of your imperfect seam,....the majority of the rest of the compressed powder in the pan should stay put.
Also by virtue of the powder being compressed down onto itself by the pan cover, that pressure should hold the powder against itself and not allow it to loosely fall into the touch hole or out the seam of the pan to pan cover.
I think the problem is you aren't using enough powder in the pan. Try what I said and let us know if that makes a difference.
If it doesn't, I would suspect your frizzen spring is weak and not holding tightly enough against the powder to keep it compressed enough against itself and that is causing powder to be loose and to dribble out.
.