When unloading a magazine to receive the ammo instead of going into your clothing/bags inventory slots it goes into a container even when there is available slots in the top or bottoms as an example.
The only way to prevent this is to have an existing stackable present in the inventory already.
For ease of gameplay the ammo should go into a slot which is available in the clothing/bags then if no slot is available it should go into a container, this will help with gameplay when needing to load a magazine as you cannot load ammo from a container anymore.