Query About Averaging Down

I bought 50 Shares of company A on 3rd Oct say at 12 pm in CNC at 55 rs each and later on that day i bought another 50 shares of same company in CNC at 2 pm at 53 rs for averaging down. So my avrage price was 54 rs. Now on the next day, 4th oct, I sold 50 shares of Company A at 56 rs. So according to First Buy First Sell, my shares which i purchased at 55 rs should have been sold and average price should have been moved to 53 rs for remaining shares. But on Zerodha Kite half of my both priced shares were sold and average price remained same. Why did it happen?

Can anyone tell me if i understood anything wrong or executed anything wrong?
Anything extra i need to do to sell shares of perticular purchased price first?
Every suggestions are welcomed.