@Finvasia
Consider I have 1000 shares of X in my demat account out of which 500 pledged and 500 is free. Now if I sell 500 shares then it should be debited from free 500 shares.
But your system is unnecessarily unpledging other 500 shares and debiting from that.
It is unnecessarily increasing pledge unpledge charges.
Please check from you end why this is happening.