lets say you have 2 of an item in your hand, and 3 of that item stored.
if you un-store the stored items while the 2 unstored items are selected, the stack of unstored items will go to 5, but the 3 previously stored items will also appear in the first slot (as long as it was previously empty)
lowkey though if you're gonna patch it, you should add a secret option to bring the glitch back