I am no developer neither, even a pure noob on XDA, but what you described may be connected to aging battery. If it is original one and was heavily used - it may be just chemically dying. Take it out and inspect if it is swollen. Mine original one is a bit, and it shows some loss of capacity and percentage drops as well. New one made by "Andida", standard dimensions, although labeled as 2200mAh, works well - almost as original 1500mAh one when it was new. It gave Defy back more stable percentage counter (although temp. sensor is not working properly), and better charge holding (original old one, seems to me to discharge itself quickly even when taken out of the phone and treated as a spare).