don't they also have to be in the top part of the pack, and not in a container within?
Yes, they have to be in the main pack to fill properly.
The bottles going onto the floor is due to the pack being at the characters max weight or over.
If your Alchemist is human, use the Taste Identification skill to I.D. the keg. You have the Jack-of-all-Trades ability giving you 20 skill.
I keep 15 Greater Heal & Strength potions in the Water Bag my Alchemist uses tending plants. There have been occasions where the refilled used bottles, refilled from the keg they were origonally filled from, won't restack with the rest in the bag without being I.D.ed. A stray bug apparently.