I have two same extension but both are using for a different-different purpose.
Extension A Config.xml
This is the same issue which i faced ,Currently you are adding before tag only in one extension so remove this line.
<before>fee</before>
you have to set the after and before tag in both of the extension.
In Extension A Config.xml file use this
<after>subtotal,discount,shipping</after>
<before>tax,grand_total</before>
and in your Extension B Config.xml file use this
<after>fee</after>
<before>tax,grand_total</before>
Hope this will help yours
The sort algorithm used by Magento is not stable and can lead to wrong results. You can use this patch: https://stackoverflow.com/a/11954867/288568