In aBuff.refresh() function, where you use the RefreshDurationFactor(), consider the following set of events:
Unit A casts buff X on himself, calculated duration: 30 seconds.
15 seconds pass.
Unit A casts buff X on himself, calculated duration: 10 seconds.
By your logic, with RefreshDurationFactor of 0.0, the new duration will be 10 seconds. With RefreshDurationFactor 1.0, it will be 25 seconds.
It may not seem evident what I'm talking about but think of it in terms of short buffs (stuns). A 2 second stun is applied, and 1ms later a 0.25 second stun is applied. There should be some way of telling the aBuff system to keep the 2 second over the 0.25 second. I'm pretty sure the WC3 engine has this same fault (have 2 units with 2 seperate bash abilities, 1000 second stun on one and 0.01 second stun on another: one will unstun the unit).